//==============================================================================
//
//            DTest - the (simple) Test class in the objc-site
//
//               Copyright (C) 2002  Dick van Oudheusden
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2003-10-31 08:12:35 $ $Revision: 1.1 $
//
//==============================================================================

#include <stdlib.h>

#include "ofc/config.h"

#include "ofc/DShort.h"

#include "DInc.h"
#include "DTest.h"

//-DataTypes-------------------------------------------------------------------

void DShort_test()
{
  DShort *i   = [[DShort alloc] init];
  DShort *c   = [[DShort alloc] init];
  char    t[] = "43.7";
  char    w[] = "ABCDE";
  char   *pt;
   
  STARTTEST();
 
  TEST([i get] == 0);
  
  TEST([[i set :7] get] == 7);
  
  TEST([[i toText] ccompare :"7"] == 0);
  
  [c set :-4];
  
  TEST([i compare :c] == 1);
  TEST([c compare :i] == -1);

  TEST([[i set :0x1234] toBigEndian   ] == 0x3412); 
  TEST([[i set :0x1234] toLittleEndian] == 0x1234);
  
  pt = t;
  TEST([i fromString :&pt] == 0);
  TEST([i get] == 43);
  TEST(*pt == '.');

  pt = w;
  TEST([i fromString :&pt] == ENODATA);

  STOPTEST();
} 

